import * as types from './types'

const state = {
  lastRoute: {}
}

const getters = {}

const actions = {
  // 记录上次的router
  [types.UpdateRouteName] ({ commit }, { lastRoute }) {
    commit(types.UpdateRouteNameSuccess, { lastRoute })
  }
}

const mutations = {
  [types.UpdateRouteNameSuccess] (state, { lastRoute }) {
    state.lastRoute = Object.assign(state.lastRoute, lastRoute)
  }
}

export default {
  state,
  getters,
  actions,
  mutations
}
